/*
 * @Descripttion:
 * @Author: jhw
 * @Date: 2024-04-24 16:33:07
 * @LastEditors: jhw
 * @LastEditTime: 2024-04-29 11:19:08
 */

import { h } from "./my/h";
import { patch } from "./my/patch";

const container = document.getElementById("container");
const vnode1 = h(
  "a",
  {
    props: {
      href: "https://www.baidu.com",
      target: "_blank",
    },
    key: "1",
  },
  "百度"
);

patch(container, vnode1);

const vnode2 = h("ul", {}, [
  h("li", { key: "3" }, "33"),
  h("li", { key: "4" }, "44"),
  h("li", { key: "5" }, "55"),
  h("li", { key: "2" }, "22"),
]);

console.log(vnode2);

const btn = document.getElementById("btn");
btn.onclick = function () {
  patch(vnode1, vnode2);
};
